
package GUIs;

// author dimi

import javax.persistence.EntityManager;


public class ShoppingCartGUI extends javax.swing.JFrame {

    private EntityManager em;
    
    // Ορίζω ως γονέα τη φόρμα CustomerGUI
    private CustomerGUI parent;
    
    public ShoppingCartGUI(CustomerGUI parent, EntityManager em) {
        this.em = em;
        this.parent = parent;
        initComponents();
        setLocationRelativeTo(null); // Κεντράρει το παράθυρο στην οθόνη
    
    } // end of ShoppingCartGUI

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Panel_ShoppingCart_Welcome = new javax.swing.JPanel();
        LabelShoppingCart_Welcome = new javax.swing.JLabel();
        Button_ShoppingCart_Exit = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        Panel_ShoppingCart_Welcome.setBackground(new java.awt.Color(0, 153, 153));
        Panel_ShoppingCart_Welcome.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(255, 204, 204), new java.awt.Color(153, 51, 255), null, null));

        LabelShoppingCart_Welcome.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        LabelShoppingCart_Welcome.setForeground(new java.awt.Color(153, 255, 255));
        LabelShoppingCart_Welcome.setText("ΚΑΛΑΘΙ ΑΓΟΡΩΝ");

        javax.swing.GroupLayout Panel_ShoppingCart_WelcomeLayout = new javax.swing.GroupLayout(Panel_ShoppingCart_Welcome);
        Panel_ShoppingCart_Welcome.setLayout(Panel_ShoppingCart_WelcomeLayout);
        Panel_ShoppingCart_WelcomeLayout.setHorizontalGroup(
            Panel_ShoppingCart_WelcomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel_ShoppingCart_WelcomeLayout.createSequentialGroup()
                .addContainerGap(112, Short.MAX_VALUE)
                .addComponent(LabelShoppingCart_Welcome, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(68, 68, 68))
        );
        Panel_ShoppingCart_WelcomeLayout.setVerticalGroup(
            Panel_ShoppingCart_WelcomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(LabelShoppingCart_Welcome)
        );

        Button_ShoppingCart_Exit.setText("ΕΞΟΔΟΣ");
        Button_ShoppingCart_Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Button_ShoppingCart_ExitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Panel_ShoppingCart_Welcome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(Button_ShoppingCart_Exit))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(Panel_ShoppingCart_Welcome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 251, Short.MAX_VALUE)
                .addComponent(Button_ShoppingCart_Exit))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Button_ShoppingCart_ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Button_ShoppingCart_ExitActionPerformed
        
        System.out.println("Επιλογή Εξόδου από τη φόρμα Διαχείρισης Καλαθιού");
        parent.setEnabled(true);
        dispose();
        
    }//GEN-LAST:event_Button_ShoppingCart_ExitActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        System.out.println("Επιλογή Εξόδου από τη φόρμα Διαχείρισης Καλαθιού");
        parent.setEnabled(true);
        dispose();
    }//GEN-LAST:event_formWindowClosing

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Button_ShoppingCart_Exit;
    private javax.swing.JLabel LabelShoppingCart_Welcome;
    private javax.swing.JPanel Panel_ShoppingCart_Welcome;
    // End of variables declaration//GEN-END:variables

} // end of class ShoppingCartGUI
